/*
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2025-06-02     Tian Yiqing      first implementation
 */

 #ifndef __DRV_CAN_H__
#define __DRV_CAN_H__

#ifdef __cplusplus
extern "C" {
#endif

#include <board.h>
#include <rtdevice.h>
#include <rtthread.h>

struct gd32_baud_rate_tab
{
    rt_uint32_t baud_rate;
    rt_uint8_t resync_jump_width;
    rt_uint8_t time_segment_1;
    rt_uint8_t time_segment_2;
    rt_uint16_t prescaler;
};

/* gd32 can device */
struct gd32_can
{
    char *name;
    uint32_t can_periph;
    can_parameter_struct            can_parameter;
    can_filter_parameter_struct     can_filter;
    struct rt_can_device            device;     /* inherit from can device */
};

int rt_hw_can_init(void);

#ifdef __cplusplus
}
#endif

#endif /*__DRV_CAN_H__ */
